package com.labofjet.service;

import java.util.List;
import java.util.concurrent.TimeUnit;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.github.pagehelper.PageHelper;
import com.labofjet.dto.Phone;
import com.labofjet.dto.PhoneExample;
import com.labofjet.mapper.PhoneMapper;

@Service
public class TestService {
	@Autowired
	private PhoneMapper phoneMapper;

	@Transactional(timeout = 2)
	public List<Phone> find5() {
//		try {
//			System.out.println(1);
//			TimeUnit.SECONDS.sleep(3);
//		} catch (InterruptedException e) {
//			e.printStackTrace();
//		}
		System.out.println(2);
		// PageHelper.startPage(1, 5, false);
		PhoneExample example = new PhoneExample();
		example.createCriteria().andIdIsNotNull();
		example.or().andIdGreaterThan(0).andPhoneNameLike("%p%");
		List<Phone> list =  phoneMapper.selectByExample(example);
		return list;
	}
}
